package com.atguigu.gmall.product.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.BaseCategoryView;
import com.atguigu.gmall.model.to.BaseCategroysTo;
import com.atguigu.gmall.product.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2025/8/29 2:00
 */

@RestController
@RequestMapping("/rpc/inner/product")
public class RpcCategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping("/categorys")
    public List<BaseCategroysTo> getCategoryAndChildrens() {
        return categoryService.getCategoryAndChildrens();
    }
    @GetMapping("/view/category")
    public BaseCategoryView getCategoryView(@RequestParam("category3Id") Long category3Id) {
        return categoryService.getCategoryView(category3Id);
    }
}
